home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Graphics 2D / Restore Screen Cluts / MenuHandler.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  4.7 KB  |  118 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        MenuHandler.h
  3.  
  4.     Contains:    Main program file for the ColorReset application
  5.  
  6.     Written by: Forrest Tanaka    
  7.  
  8.     Copyright:    Copyright © 1988-1999 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                 7/13/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  20.                 
  21.  
  22. */
  23. #ifndef __MENUHANDLER__
  24. #define __MENUHANDLER__
  25.  
  26.  
  27.  
  28. /******************************************************************************\
  29. * Constants
  30. \******************************************************************************/
  31.  
  32. #define mApple 128 /* Menu ID and resource ID of Apple menu */
  33. #define iAbout   1 /* Menu item number of About SevenPaint item */
  34.  
  35. #define mFile 129 /* Menu ID and resource ID of File menu */
  36. #define iOpen   1 /* Menu item number of Open… item */
  37. #define iClose  3 /* Menu item number of Close item */
  38. #define iSaveAs 4 /* Menu item number of Save As… item */
  39. #define iQuit   6 /* Menu item number of Quit item */
  40.  
  41. #define mEdit 130 /* Menu ID and resource ID of Edit menu */
  42. #define iUndo   1 /* Menu item number of Undo item */
  43. #define iCut    3 /* Menu item number of Cut item */
  44. #define iCopy   4 /* Menu item number of Copy item */
  45. #define iPaste  5 /* Menu item number of Paste item */
  46. #define iClear  6 /* Menu item number of Undo item */
  47.  
  48. #define mDisplay     131 /* Menu ID and resource ID of Display menu */
  49. #define iDithering   1   /* Menu item number of Dithering item */
  50. #define iForeground  2   /* Menu item number of Foreground Color… item */
  51. #define iBackgreound 3   /* Menu item number of Background Color… item */
  52.  
  53. #define mLastMenu mDisplay /* Menu ID of the last menu in the menu bar */
  54.  
  55.  
  56. /******************************************************************************\
  57. * StartMenus - Do additional initialization of the menus
  58. *
  59. * This routine is called just after calling the Utilities sample code routine,
  60. * StandardMenuSetup.  This application needs to do just a little bit of
  61. * additional initialization for menus.  See MenuHandler.c for details.
  62. *
  63. * If there isn’t enough memory to load the menus, then memFullErr is returned.
  64. * If desired menu resources couldn’t be found, then resNotFound is returned.  If
  65. * any other error occurs, then dsSysErr is returned.
  66. \******************************************************************************/
  67.  
  68. OSErr StartMenus(void);
  69.  
  70.  
  71. /******************************************************************************\
  72. * DoMenuChoice - Dispatch to the appropriate routine for a menu choice
  73. *
  74. * When it’s determined that a menu item was chosen, this routine is called to
  75. * dispatch to the appropriate routine for the chosen menu item.  The menu item
  76. * and menu number returned by MenuSelect and MenuKey is passed in the menuChoice
  77. * parameter.
  78. \******************************************************************************/
  79.  
  80. void DoMenuChoice(
  81.     long menuChoice);
  82.  
  83.  
  84. /******************************************************************************\
  85. * FixMenus - Fix menus so that proper items are enabled and marked
  86. *
  87. * FixMenus is called to assure that menu items are disable, enabled, marked, and
  88. * unmarked appropriately.  It’s called at the end of every iteration of the main
  89. * event loop.
  90. \******************************************************************************/
  91.  
  92. void FixMenus(void);
  93.  
  94.  
  95. /******************************************************************************\
  96. * DisableAllMenus - Disable all menus except for the Help and Keyboard menus
  97. *
  98. * This routine disables all menus for a modal dialog box.  To restore all the
  99. * menu’s enable states back to the way they were, call RestoreAllMenus.
  100. * FixMenus should not be called between the calls to DisableAllMenus and
  101. * ReenableAllMenus.
  102. \******************************************************************************/
  103.  
  104. void DisableAllMenus(void);
  105.  
  106.  
  107. /******************************************************************************\
  108. * ReenableAllMenus - Reenable menus that were enabled at DisableAllMenus
  109. *
  110. * ReenableAllMenus reenables all menus that were disabled with DisableAllMenus.
  111. * This routine should be called after a modal dialog box goes away.
  112. \******************************************************************************/
  113.  
  114. void ReenableAllMenus(void);
  115.  
  116.  
  117. #endif
  118.